<?php
/**
 * Created by PhpStorm.
 * User: albert
 * Date: 18-1-16
 * Time: 下午3:24
 */

namespace apis\base;


use yii\filters\auth\CompositeAuth;
use yii\filters\auth\HttpBasicAuth;
use yii\filters\auth\HttpBearerAuth;
use yii\filters\auth\QueryParamAuth;
use yii\swoole\filter\Cors;
use yii\swoole\helpers\ArrayHelper;
use yii\swoole\rest\ActiveController as Controller;

class ActiveController extends Controller
{
    public function behaviors()
    {
        return ArrayHelper::merge([
            'corsFilter' => [
                'class' => Cors::class
            ],
            'authenticator' => [
                'class' => CompositeAuth::class,
                'authMethods' => [
                    HttpBasicAuth::class,
                    HttpBearerAuth::class,
                    QueryParamAuth::class,
                ],
            ]
        ], parent::behaviors());
    }
}